import React from 'react';
import ReactDOM from 'react-dom';
const { Provider, Consumer } = React.createContext() 
class Com1 extends React.Component { 
  state={a:100, obj:{a:1,b:2}}
	render() {return (
    <Provider value={this.state.obj}>
      <div>com1:<Com11 /></div>
    </Provider>
  )}
} 
class Com11 extends React.Component { 
	render() {
    return (
    <div>com11 :<Com111/></div>

    )
  }
} 
class Com111 extends React.Component { 
	render() {return (
    <Consumer>
      { 
        data => <div> com111<span>{data.toString()}</span> </div>
      }
    </Consumer>
  )}
} 
ReactDOM.render(
<div>
  <Com1 />
</div>, document.getElementById('root')) 